package com.ky.server.service;

import com.ky.common.dto.Dto;
import com.ky.common.entity.KyUser;
import com.ky.server.dao.UserDao;

public class LoginService implements service<KyUser>{

	@Override
	public Dto service(KyUser data) {
		Dto<Object> resopnseDto = new Dto<>();
		/*
		 * 判断用户是否登录成功
		 * ①先获取用户的登录信息
		 * ②判断用户输入的信息与xml文件中的是否一致
		 */
		KyUser xmlUser = UserDao.getUserByName(data.getUserName());
		if(xmlUser!=null && data.getUserPwd().equals(xmlUser.getUserPwd())) {
			resopnseDto.setCode(200);
		}
		resopnseDto.setCode(10001);
		resopnseDto.setErrorMsg("用户名和密码不匹配！");
		return resopnseDto;
	}

}
